/*
   +----------------------------------------------------------------------+
   | This library is free software; you can redistribute it and/or        |
   | modify it under the terms of the GNU Lesser General Public           |
   | License as published by the Free Software Foundation; either         |
   | version 2.1 of the License, or (at your option) any later version.   | 
   |                                                                      |
   | This library is distributed in the hope that it will be useful,      |
   | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
   | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    |
   | Lesser General Public License for more details.                      | 
   |                                                                      |
   | You should have received a copy of the GNU Lesser General Public     |
   | License in the file LICENSE along with this library;                 |
   | if not, write to the                                                 | 
   |                                                                      |
   |   Free Software Foundation, Inc.,                                    |
   |   51 Franklin Street, Fifth Floor,                                   |
   |   Boston, MA  02110-1301  USA                                        |
   +----------------------------------------------------------------------+
   | Authors: Alayn Gortazar <zutoin@gmail.com>                           |
   +----------------------------------------------------------------------+
*/

/* $ Id: $ */ 

#ifndef PHP_AVAHII_H
#define PHP_AVAHII_H

#ifdef  __cplusplus
extern "C" {
#endif

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <php.h>

#ifdef HAVE_AVAHII

#include <php_ini.h>
#include <SAPI.h>
#include <ext/standard/info.h>
#include <Zend/zend_extensions.h>
#ifdef  __cplusplus
} // extern "C" 
#endif
#ifdef  __cplusplus
extern "C" {
#endif

extern zend_module_entry avahii_module_entry;
#define phpext_avahii_ptr &avahii_module_entry

#ifdef PHP_WIN32
#define PHP_AVAHII_API __declspec(dllexport)
#else
#define PHP_AVAHII_API
#endif

PHP_MINIT_FUNCTION(avahii);
PHP_MSHUTDOWN_FUNCTION(avahii);
PHP_RINIT_FUNCTION(avahii);
PHP_RSHUTDOWN_FUNCTION(avahii);
PHP_MINFO_FUNCTION(avahii);

#ifdef ZTS
#include "TSRM.h"
#endif

#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource))

#define PROP_GET_LONG(name)    Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC)

#define PROP_GET_DOUBLE(name)    Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC)

#define PROP_GET_STRING(name)    Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
#define PROP_GET_STRLEN(name)    Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC)
#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC)


PHP_METHOD(Avahi_Service, getName);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__getName_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__getName_args NULL
#endif

PHP_METHOD(Avahi_Service, setName);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__setName_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
  ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__setName_args NULL
#endif

PHP_METHOD(Avahi_Service, getType);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__getType_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__getType_args NULL
#endif

PHP_METHOD(Avahi_Service, setType);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__setType_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
  ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__setType_args NULL
#endif

PHP_METHOD(Avahi_Service, getDomain);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__getDomain_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__getDomain_args NULL
#endif

PHP_METHOD(Avahi_Service, setDomain);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__setDomain_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
  ZEND_ARG_INFO(0, domain)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__setDomain_args NULL
#endif

PHP_METHOD(Avahi_Service, getHostname);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__getHostname_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__getHostname_args NULL
#endif

PHP_METHOD(Avahi_Service, setHostname);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__setHostname_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
  ZEND_ARG_INFO(0, hostname)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__setHostname_args NULL
#endif

PHP_METHOD(Avahi_Service, getAddress);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__getAddress_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__getAddress_args NULL
#endif

PHP_METHOD(Avahi_Service, setAddress);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__setAddress_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
  ZEND_ARG_INFO(0, address)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__setAddress_args NULL
#endif

PHP_METHOD(Avahi_Service, getPort);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__getPort_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__getPort_args NULL
#endif

PHP_METHOD(Avahi_Service, setPort);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__setPort_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
  ZEND_ARG_INFO(0, port)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__setPort_args NULL
#endif

PHP_METHOD(Avahi_Service, getTxt);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__getTxt_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__getTxt_args NULL
#endif

PHP_METHOD(Avahi_Service, setTxt);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__setTxt_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
  ZEND_ARG_INFO(0, txt)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__setTxt_args NULL
#endif

PHP_METHOD(Avahi_Service, publish);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_Service__publish_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_Service__publish_args NULL
#endif

PHP_METHOD(Avahi_ServiceBrowser, browse);
#if (PHP_MAJOR_VERSION >= 5)
ZEND_BEGIN_ARG_INFO_EX(Avahi_ServiceBrowser__browse_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
  ZEND_ARG_INFO(0, type)
  ZEND_ARG_INFO(0, domain)
ZEND_END_ARG_INFO()
#else /* PHP 4.x */
#define Avahi_ServiceBrowser__browse_args NULL
#endif

#ifdef  __cplusplus
} // extern "C" 
#endif

typedef struct _Avahi_Service_object {
	zend_object std;
} Avahi_Service_object;


#endif /* PHP_HAVE_AVAHII */

#endif /* PHP_AVAHII_H */


/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 * vim600: noet sw=4 ts=4 fdm=marker
 * vim<600: noet sw=4 ts=4
 */
